package ru.ifmo.tanya.xml;

import org.jdom.Document;
import org.jdom.Element;
import org.jdom.output.XMLOutputter;
import org.jdom.transform.XSLTransformException;
import org.jdom.transform.XSLTransformer;

import java.io.InputStream;

/**
 * User: nikart
 * Date: 1/27/13
 * Time: 12:05 AM
 */
public class SaxonXmlProcessor {

    public String process(Element element, InputStream xslStream) throws XSLTransformException {
        XSLTransformer transformer = new XSLTransformer(xslStream);
        Document document = transformer.transform(new Document(element));
        XMLOutputter xmlOutputter = new XMLOutputter();
        return xmlOutputter.outputString(document);
    }
}
